﻿#region namespaces

using System;
using System.IO;

#endregion

namespace ZOIL.DataBackend.BaseX
{
    public sealed partial class Database : IDisposable
    {
        #region Implementation of IDisposable

        /// <summary>
        ///     Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        /// <filterpriority>2</filterpriority>
        public void Dispose()
        {
            try
            {
                StopWatchingEventsFromDatabase();
            }
            catch (IOException)
            {
            }
            try
            {
                _client.Dispose();
            }
            catch (ObjectDisposedException)
            {
            }
            catch (IOException)
            {
            }
        }

        #endregion
    }
}